setImmediate(function () {
    console.log(1);
    process.nextTick(function () {
        console.log(4);
    })
});
process.nextTick(function () {
    console.log(2);
    setImmediate(function () {
        console.log(3);
    })
});
/*
2
1
3
4*/